package com.tensquare.recruit.controller;

import com.tensquare.recruit.pojo.Recruit;
import com.tensquare.recruit.service.RecruitService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("recruit")
@CrossOrigin
public class RecruitController {

    @Autowired
    private RecruitService recruitService;

    //查询职位推荐列表
    //查询状态为2并以创建日期降序排序，查询前4条记录
    @GetMapping(value = "search/recommend")
    public Result searchRecommendList(){
        List<Recruit> recruitList=recruitService.findRecommendList();
        return new Result(true,StatusCode.OK,"推荐职业列表",recruitList);
    }
    //最新职位列表
    //查询状态不为0并以创建日期降序排序，查询前12条记录
    @GetMapping(value = "search/newlist")
    public Result searchNewList(){
       List<Recruit> recruitList=recruitService.findNewList();
       return new Result(true,StatusCode.OK,"最新职位列表",recruitList);
    }
}
